using DG.Tweening;
using UnityEngine;
namespace CGF
{
    public partial class PanelCompare : UIComponentBase, IAwake<UILayer, bool>, IDestroy
    {
        
        public static void Open()
        {
            UIManagerComponent.instance.OpenUI<PanelCompare>(UILayer.Normal, RootComponent.instance, true);
        }

        public static void Close()
        {
            UIManagerComponent.instance.CloseUI<PanelCompare>();
        }

        public async void Awake(UILayer layer, bool isFloat)
        {
            await SpawnPrefab("Prefabs/GameUI/PanelCompare", layer, isFloat);
			BindProperties(transform);
            
            BtnClose.SetClick(Close);
            
            BlackboardFadeIn();
            float dialogOutY = -Dialog.rectTransform.rect.height;
            Dialog.rectTransform.anchoredPosition = new Vector2(Dialog.rectTransform.anchoredPosition.x, dialogOutY);
            Dialog.rectTransform.DOAnchorPosY(20, 0.2f).OnComplete(() =>
            {
                Dialog.rectTransform.DOAnchorPosY(0, 0.1f);
            });
        }

        public override void OnDestroy()
        {
            base.OnDestroy();
        }

    }
}
